project(biblio)
cmake_minimum_required(VERSION 2.6)
find_package(Qt4 REQUIRED)

include_directories(${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR})

add_custom_command (
		OUTPUT paper.pb.cc
		COMMAND protoc
		ARGS -I=${CMAKE_CURRENT_SOURCE_DIR}
		--cpp_out=${CMAKE_CURRENT_BINARY_DIR}
		${CMAKE_CURRENT_SOURCE_DIR}/paper.proto
		DEPENDS paper.proto
		)

add_custom_command (
		OUTPUT paper.pb.h
		COMMAND protoc
		ARGS -I=${CMAKE_CURRENT_SOURCE_DIR}
		--cpp_out=${CMAKE_CURRENT_BINARY_DIR}
		${CMAKE_CURRENT_SOURCE_DIR}/paper.proto
		DEPENDS paper.proto
		)

set(biblio_SRCS main.cpp data.cpp mainwin.cpp paper.pb.cc dialogs.cpp)
qt4_automoc(${biblio_SRCS})
set(biblio_UIS mainwindow.ui datachanged_dialog.ui)
QT4_WRAP_UI(biblio_UI_SRCS ${biblio_UIS})
add_executable(biblio 
	      ${biblio_SRCS}
	      ${biblio_UI_SRCS}
)
target_link_libraries(biblio ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY})
target_link_libraries(biblio db_cxx)
target_link_libraries(biblio protobuf pthread)
